﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HIWSystem.Attributes
{
    /// <summary>
    /// 自定义必填项验证特性类
    /// </summary>
    public class RequiredAttribute : BaseValidateAttribute
    {
        public RequiredAttribute(string description)
        {
            _description = description;
        }
        private string _description;
        /// <summary>
        /// 验证的描述信息
        /// </summary>
        public override string Description
        {
            get { return _description; }
            set { _description = value; }
        }
        /// <summary>
        /// 验证
        /// </summary>
        /// <param name="value">值</param>
        /// <returns></returns>
        public override bool Validate(object value)
        {
            return value != null && !string.IsNullOrEmpty(value.ToString());
        }
    }
}
